using System;
using System.Collections.Generic;
using System.Text;
using SharpMud.Server.Systems.Scripting.Processing;
using SharpMud.Server.Systems.Scripting.Processing.Source;

namespace SharpMud.Server.Systems.Scripting.Runtime
{
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
    public sealed class ScriptSourceAttribute : System.Attribute, IComparable<IScriptSourceHandle>
    {
        private System.Uri _ScriptLocation;
        private System.Guid _HashGuid;
        
        public ScriptSourceAttribute(System.Uri scriptLocation, System.Guid hashGuid)
        {
            _ScriptLocation = scriptLocation;
            _HashGuid = hashGuid;
        }

        public System.Uri ScriptLocation
        {
            get
            {
                return _ScriptLocation;
            }
        }

        public System.Guid HashGuid
        {
            get
            {
                return _HashGuid;
            }
        }

        #region IComparable<IScriptSourceHandle> Members

        public int CompareTo(IScriptSourceHandle other)
        {
            if (this._HashGuid.Equals(other.ContentHash))
            {
                return 0;
            }
            else
            {
                return this._HashGuid.CompareTo(other.ContentHash);
            }
        }

        #endregion
    }
}
